"""
发送post请求
"""
import requests

url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule'
h = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36'
}
# 请求数据
d = {
    'i': '好好学习',
    'from': 'AUTO',
    'to': 'AUTO',
    'smartresult': 'dict',
    'client': 'fanyideskweb',
    'salt': '16057682615040',
    'sign': '3756caa932d809afcea01819181986b0',
    'lts': '1605768261504',
    'bv': '02edb5d6c6ac428cd4393133e5aab14',
    'doctype': 'json',
    'version': '2.1',
    'keyfrom': 'fanyi.web',
    'action': 'FY_BY_REALTlME',

}

# 发送post请求
responese = requests.post(url, headers=h, data=d)
print(responese.content.decode())

url2 = 'http://fy.iciba.com/ajax.php?a=fy'
h2 = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}

data2 = {
    'f': 'auto',
     't': 'auto',
    'w': '天天向上'
}
r=requests.post(url2,headers=h2,data=data2)
print(r.content.decode())